package com.jrx.anytxn.reporting.job.lsFile.step;

import com.jrx.anytxn.reporting.config.LSFileConfig;
import com.jrx.anytxn.reporting.constant.ReportingConstant;
import com.jrx.anytxn.reporting.service.ILSFileService;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 生成特殊交易文件 Listener
 *
 * @author liuyang
 * @date 2021-03-13
 */
@Service
public class LSSpecialTranFileListener implements JobExecutionListener {

    @Autowired
    private LSFileConfig fileConfig;
    @Autowired
    private ILSFileService fileService;

    @Override
    public void beforeJob(JobExecution jobExecution) {

        String reportingPath = fileConfig.getLsFilePath();
        String fileName = fileConfig.getLsFileName();

        fileService.createDirectoriesAndFile(reportingPath,fileName, ReportingConstant.PAPH_FILE_TYPE_SPECBUSINESS, ReportingConstant.LS_FILE_SUFFIX);
    }

    @Override
    public void afterJob(JobExecution jobExecution) {

    }
}
